<!DOCTYPE html>
<html lang="en">
<include file="CommonSidebar:common-head"/>
<link href="__ROOT__/Application/Admin/Public/css/jquery.datetimepicker.css" rel="stylesheet">
<body>
<link href="__ROOT__/Application/Admin/Public/css/cropper/cropper.min.css" rel="stylesheet">
<link href="__ROOT__/Application/Admin/Public/css/main.css" rel="stylesheet">
<js href="__ROOT__/Application/Admin/Public/ueditor/ueditor.config.js"/>
<js href="__ROOT__/Application/Admin/Public/ueditor/ueditor.all.min.js"/>
<js href="__ROOT__/Application/Admin/Public/js/jquery-2.0.2.js"/>

<div id="wrapper">

    <!-- Navigation -->
    <include file="CommonSidebar:common-navbar"/>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">消息模板</h1>
            </div>
        </div>

        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                            <div class="panel panel-default">
                                <div class="panel-heading" role="tab" id="headingOne">
                                    <h4 class="panel-title">
                                        <a role="button" data-toggle="collapse" data-parent="#accordion"
                                           href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                            开团通知
                                        </a>
                                    </h4>
                                </div>
                                <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel"
                                     aria-labelledby="headingOne">
                                    <div class="panel-body">
                                        <div class="col-sm-2 col-sm-offset-1">
                                            <a onclick="sendAll()"
                                               class="btn btn-block btn-primary">发送给所有用户
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>

    </div>
    <!-- /#page-wrapper -->

</div>

<!--进度条-->
<div class="modal fade dialogsecc" id="myModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header" style="height:30px;">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"></h4>
            </div>
            <div class="modal-body">
                <div class="progress" style="    background: #CCC;    margin: 0;    height: 50px;    border-radius: 0;">
                    <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0"
                         aria-valuemax="100" style="width: 60%; ">
                        60%
                    </div>
                </div>
            </div>
            <div class="modal-footer" style="height:30px;">

            </div>
        </div>
    </div>
</div>
<!--进度条-->
<include file="CommonSidebar:common-script"/>
<!-- Custom Theme JavaScript -->
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>
<script type="text/javascript" src="__ROOT__/Application/Admin/Public/js/uploadPreview.js"></script>
<script type="text/javascript" src="__ROOT__/Application/Admin/Public/js/jquery.form.min.js"></script>
<script type="text/javascript" src="__ROOT__/Application/Admin/Public/js/jquery.qrcode.min.js"></script>


<include file="Common:common-cropper"/>
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>
<script type="text/javascript" src="__ROOT__/Application/Admin/Public/js/bootstrapValidator.js"></script>
<script src="__ROOT__/Application/Admin/Public/js/cropper/cropper.min.js"></script>
<script src="__ROOT__/Application/Admin/Public/js/figure.js"></script>


</body>
<script>
    //保存
    function bc(elem) {
        $('#bc').hide();
        $('#fs').show();
        $("input[class='form-control']").each(function (index, item) {
            $(this).attr("readonly", "readonly");
        });
    }
    //重新编辑
    function cx(elem) {
        $("input[class='form-control']").each(function (index, item) {
            $(this).removeAttr("readonly");
        });
        $('#fs').hide();
        $('#bc').show();
    }
    //发送所有人
    function sendAll() {
        if (confirm("是否确认发送给所有人？？")) {
            var count = {$count};
            ajaxing(count);
        }
    }
    function ajaxing(counts) {
        alert("总共更新数据:" + counts + "条");
        ajaxing2(0, counts);
    }
    function ajaxing2(id, counts) {
        var jdd = ((id / counts) * 100);
        var OPENIDS = {$OPENIDALL};
        var OPENID = OPENIDS[id]['OPENID'];
        $(".progress-bar").html(jdd.toFixed(1) + '%').width(jdd + '%');
        if (id < counts) {
            $("#myModal").modal();
            $.post("{:U('AddWxUser')}",
                    {
                        OPENID: OPENID
                    },
                    function (data) {
                        if(data){
                            setTimeout(ajaxing2((id + 1), counts), 300);
                        }else{
                            alert("发送失败哦");
                        }
                    });
        } else {
            location.reload();
            return false;
        }
    }
</script>
<script>

</script>
</html>
